#include <iostream>
using namespace std;

int main(){
	
	int n,m;
	cin >> n >> m;
	
	int d[n],ans[m];
	int s[n] = {0};
	for(int i = 0; i < n ; i++){
		cin >> d[i];
	}
	for(int i = 1; i < n ; i++){
		if(d[i] - d[i - 1] > 0){
			s[i] += d[i] - d[i - 1] + s[i - 1];
		}else{
			s[i] = s[i - 1];
		}
	}
	int k;
	cin >> k;
	
	for(int i = 0; i < m ; i++){
		int x,y;
		cin >> x >> y;
		ans[i] = s[y-1] - s[x - 1] + k;
	}

	for(int i = 0; i < m ; i++){
		cout << ans[i];
		if(i != m - 1){
			cout << endl;
		}
	}
	
	return 0;
}
